<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="blank">
	<meta name="format-detection" content="telephone=no, email=no">
	<meta name="msapplication-tap-highlight" content="no">
	<link rel="stylesheet" type="text/css" href="/views/mobile/skin/css/style.css" />
	<title><{config_item('website_title')}></title>
</head>
<body>
<div class="wrap">
<form name="info" id="info" method="post" action="<{site_url("/<{get_segment(1)}>/member/welcome/info_act")}>" class="paddbottom">
	<!-- 头像 -->
	<div class="bordercells">
		<div class="userphotobox flexbox">
			<div class="userchar">
				头像
			</div>
			<div class="photobox">
				<img src="<{$member_data.headimgurl}>" id="userphoto">
			</div>
		</div>
	</div>
	<!-- 昵称 -->
	<div class="bordercells">
		<!-- 昵称 -->
		<div class="inputTbox flexbox">
			<div class="userchar">
				昵称
			</div>
			<div class="inputTextbox flexbox">
				<input type="text" class="inputText" name="full_name" datatype="*" nullmsg="昵称不能为空">
			</div>
		</div>
		<!--  电话-->
		<div class="inputTbox flexbox">
			<div class="userchar">
				电话
			</div>
			<div class="inputTextbox flexbox">
				<input type="text" class="inputText" name="tel" datatype="m" nullmsg="电话不能为空" errormsg="手机号码格式错误">
			</div>
		</div>
		<!-- 性别 -->
		<div class="inputTbox flexbox">
			<div class="userchar">
				性别
			</div>
			<div class="inputTextbox flexbox">
				<label  for="male">
					  <div class="radiowrap flexbox ">
					  	<div class="radioDbox" style="margin-right:0.2rem;">
					  		<input type="radio" name="sex" class="inputradio" id="male" value="1" checked>
					  		<span></span>
					  	</div>
						<div class="deliveryD">
							男
						</div>
					  </div>
				  </label>
				  <label for="female">
					  <div class="radiowrap  flexbox">
					  	<div class="radioDbox">
					  		<input type="radio" name="sex" class="inputradio" id="female" value="2">
					  		<span></span>
					  	</div>
						<div class="deliveryD">
							女
						</div>
					  </div>
				  </label>
			</div>
		</div>
		<!-- 地区 -->
		<div class="inputTbox flexbox">
			<div class="userchar">
				地区
			</div>
			<div class="inputTextbox flexbox">
				<div class="selectbox">
					<select name="prov" class="select" onchange="area_list('city',this.value);">
					<option>省</option>
					</select>
				</div>
				<div class="selectbox">
					<select name="city" class="select" onchange="area_list('area',this.value);">
						<option>市</option>
					</select>
				</div>
				<div class="selectbox">
					<select name="area" class="select">
						<option>区</option>
					</select>
				</div>
			</div>
		</div>
	</div>
	<div class="infosub">
		<input type="submit" value="保 存"  class="infosubbtn">
	</div>
</form>
</div>
<script type="text/javascript" src="/public/js/jquery.js"></script>
<script type="text/javascript" src="/views/mobile/skin/js/public.js"></script>
<script type="text/javascript" src="/public/js/layer/layer.js"></script>
<script type="text/javascript" src="/public/js/validform.js"></script>
<script type="text/javascript" src="/public/js/form.js"></script>
<{include file="mobile/footer.html"}>
<{plupload('userphoto',['width'=>300,'height'=>300])}>
<script type="text/javascript" >
	//验证表单
	$(function(){
		$.Tipmsg.r=null;
		$("#info").Validform({
			tiptype:function(msg){
				layer.msg(msg);
			},
			tipSweep:true,
			ajaxPost:true,
			callback:function(data){
				if(data.status=="y"){
					layer.msg('修改成功');
					
					setTimeout(function(){
						window.location.href="<{site_url("/<{get_segment(1)}>/member")}>";
					},1000)
				}
			}
		});

		//表单回填
		var formObj = new Form();
		formObj.init(<{ch_json_encode($member_user_data)}>);
	})

	//添加图片展示
	function show_plupload(pic_data){
		if(pic_data.url!='') {
			$.ajax({
				type:"POST",
				url: "<{site_url("/<{get_segment(1)}>/member/welcome/headimgurl_save")}>",
				data: "headimgurl="+pic_data.url,
				dataType:"json",
				success: function(data){
					if (data.status=='y') {
						$("#userphoto").attr('src',pic_data.url);
					} else {
						layer.msg(data.info);
					}
				}
			});
		}
	}

	//地区加载area_name 选择框名称 parent_id 上级id default_id默认id
	function area_list(area_name, parent_id, default_id){
		$.ajax({
			type:"POST",
			url: '<{site_url("/api/area/get_list")}>',
			data: 'parent_id='+parent_id+'&default_id='+default_id,
			dataType:"html",
			success: function(data){
				$('[name="'+area_name+'"]').html(data);
			}
		});
	}

	//省市区回填
	area_list('prov', 0 <{if $member_user_data.prov!=''}>,<{$member_user_data.prov}><{/if}>);//省份选择
	<{if $member_user_data.city!='' && $member_user_data.prov!=''}>
	area_list('city', <{$member_user_data.prov}>, <{$member_user_data.city}>);//市
	<{/if}>
	<{if $member_user_data.area!='' && $member_user_data.city!=''}>
	area_list('area', <{$member_user_data.city}>, <{$member_user_data.area}>);//区
	<{/if}>
</script>
</body>
</html>